//
//  NetRequestClass.h
//  MyAFNetWorking
//
//  Created by jianglinfeng on 16/1/27.
//  Copyright © 2016年 jianglinfeng. All rights reserved.
//

#import <Foundation/Foundation.h>
//#import "interface.h"

//定义返回请求数据的block类型
typedef void (^ReturnValueBlock)(id returnValue);
typedef void (^ErrorCodeBlock)(id errorCode);
typedef void (^FailuresBlock)();
typedef void (^NetWorkBlock)(BOOL netConnectState);
typedef void (^NetValueBlock)(id returnValue, id data);

@interface NetRequestClass : NSObject

#pragma mark 检测网络的可链接性
+ (void)NetWorkReachabilityWithURLString:(NSString *)url
                               parameter:(NSMutableDictionary *)parameter
                                  result:(NetValueBlock)block;

#pragma mark POST请求
+ (void)NetRequestPOSTWithRequestURL: (NSString *)requestURLString
                       WithParameter: (NSDictionary *)parameter
                WithReturnValueBlock: (ReturnValueBlock)block
                  WithErrorCodeBlock: (ErrorCodeBlock)errorBlock;

#pragma mark GET请求
+ (void)NetRequestGETWithRequestURL: (NSString *)requestURLString
                      WithParameter: (NSDictionary *)parameter
               WithReturnValueBlock: (ReturnValueBlock)block
                 WithErrorCodeBlock: (ErrorCodeBlock)errorBlock
                   WithFailureBlock: (FailuresBlock)failureBlock;

#pragma mark 通用请求
+ (void)NetCommonRequest:(NSMutableDictionary *)parameter
                 withUrl:(NSString *)url
    WithReturnValueBlock:(ReturnValueBlock)block
      WithErrorCodeBlock:(ErrorCodeBlock)errorBlock;

#pragma mark 上传图片
+ (void)NetUploadFilesPOSTWithRequestURL:(NSString *)requestURLString
                           withParameter:(NSMutableDictionary *)parameter
                                    data:(NSData *)imageData
                            compressData:(NSData *)compressData//压缩图片
                                    name:(NSString *)name
                                fileName:(NSString *)fileName
                                mimeType:(NSString *)mimeType
                    WithReturnValeuBlock: (ReturnValueBlock) block
                      WithErrorCodeBlock: (ErrorCodeBlock) errorBlock
                        WithFailureBlock: (FailuresBlock) failureBlock;

@end
